package com.dingdang.controller.admin.admin;

import com.dingdang.model.AdminLeftNav;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * 后台页面跳转控制类Gasstation
 */
@Controller
@RequestMapping("/admin/activity")
public class ActivityViewController {

    //  管理后台登录后首页
    @RequestMapping("activityIndex")
    public String index(Model model,int index,String openPage) {
        List<AdminLeftNav> allAdminLeftNav6 = new ArrayList<AdminLeftNav>(){{
                    add(new AdminLeftNav("优惠券管理", "activityIndex?index=0&openPage=activityCenterFirst",0));
                    add(new AdminLeftNav("加油站活动", "activityIndex?index=1&openPage=gasstationActivity",0));
                    add(new AdminLeftNav("攒油活动", "activityIndex?index=2&openPage=saveOil",0));
                }};
                allAdminLeftNav6.get(index).setIsActive(1);
                model.addAttribute("adminLeftNav",allAdminLeftNav6);
                model.addAttribute("openPage", openPage);
                model.addAttribute("isHeadActive", 6);
        return "admin/activityCenter";
    }

    @RequestMapping("activityCenterFirst")
    public String activityCenterFirst() {
        return "admin/coupon";
    }

    @RequestMapping("gasstationActivity")
    public String gasstationActivity() {
        return "admin/gasstationActivity";
    }

    @RequestMapping("saveOil")
    public String saveOil() {
        return "admin/saveOil";
    }

}
